package com.cf.controller;

import com.cf.cache.ZCache;
import com.cf.cache.core.CacheUpdatePusher;
import com.cf.model.TestVo;
import com.cf.model.ZongService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * boot-cache-TestController
 *
 * @author <a href="2428922347@qq.com">Zhu mingming</a>
 * @info
 * @since 2018/7/17 下午 12:23
 */
@RestController
public class TestController {


    @Autowired
    private ZongService zongService;

    @Autowired
    private CacheUpdatePusher cacheUpdatePusher;

    @ZCache(key = "'controller-all'")
    @RequestMapping("/all")
    public List<TestVo> getAll() {
        return zongService.all();
    }

    @RequestMapping("/update")
    public String update() {
        cacheUpdatePusher.push("com.cf.model.Test-1");
        return "success";
    }

}
